<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.w3.org/1999/xhtml" >
<head>
    <meta charset="UTF-8">
    <title>大咖说管理</title>
    <script src="/js/jquery-2.1.1.min.js"></script>


    <link rel="stylesheet" href="/js/easyui1.5/themes/icon.css">
    <link rel="stylesheet" href="/js/easyui1.5/themes/default/easyui.css">
    <script src="/js/easyui1.5/jquery.easyui.min.js"></script>
    <link rel="stylesheet" href="/layer/mobile/need/layer.css">
</head>
<script type="text/javascript"  th:inline="none">


    $(function () {
       queryDKS();
    })


    function queryDKS(){


        $("#dg").datagrid({

            url:'/user/queryDKS',
            striped:true,
            pagination:true,
            toolbar:"#gongneng",
            pageList:[1,2,3,4,5,7,10],
            pageSize:5,
            checkOnSelect:false,
            columns:[[
                {field:'xxx',title:'xx',width:100,checkbox:true,align:'center'},
                {field:'img',title:'大咖头像',width:100,align:'center',
                    formatter:function(value,row,index){
                        return "<img width='77' src='"+value+"'>";
                    }
                },
                {field:'bktext',title:'内容',width:100,align:'center'},
                {field:'bkdate',title:'发表时间',width:100,align:'center',
                    formatter: function(value,row,index){
                        //        console.log("==>"+value)
                        //字符串 转成日期对象
                        var mydate = new Date(value)//格式化日期
                        var str = mydate.toLocaleDateString()//日期对象的方法
                        return str;
                    }},


                  {field:'aaaa',title:'操作',width:300,align:'center',
                    formatter:function(value,row,index){
                        var content = " <a href='JavaScript:deleteDKS("+row.bkid+")' >删除</a> ";
                        return content;
                    }
                }
            ]]

        })
    }



    function deleteDKS(ids) {

        $.ajax({
            url:"/user/deleteDKS",
            type:"POST",
            data:{ids:ids},
            success:function(res){
                queryDKS();
                $.messager.alert('提示','</br><center>删除成功!</center>');
            },
            error:function(){
                $.messager.alert("网络异常");
            }
        })
    }



</script>


<body>

<div id="gongneng">
</div>
<table id="dg" fit="true"></table>


</body>
</html>